package top.yxqin.easymine.PlayerData;

import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

import java.util.Map;
import java.util.TreeMap;

//玩家在线列表 根据玩家名为唯一标识符
//采用b-tree 存储
public final class PlayerList
{
    private static Map<String,PlayerData> list=new TreeMap<>();
    public static void clear()
    {
        list.clear();
    }
    //添加在线玩家
    public static void addPlayer(@NotNull String playerName)
    {
        list.put(playerName.toLowerCase(),new PlayerData());
    }
    //移除在线玩家
    public static void rmPlayer(@NotNull String name)
    {
        list.remove(name.toLowerCase());
    }
    @NotNull
    public static PlayerData getPlayerData(String name)
    {
        return list.get(name.toLowerCase());
    }

}
